#!usr/bin/env python3

# https://github.com/miguelgrinberg/flasky 源码
#http://127.0.0.1:5000/
from handler import app,db,manager
from dbModel import Role,User,commit,delete,selectAll,selectOne
from datetime import datetime
import sys

print("Hello wellcome to flask ! now is ")


def createRoles(roleNames):
    rets = []
    for v in roleNames:        
        rets.append(Role(name=v))
    return rets

def createUsers(userNames):
    rets = []
    for v in userNames:
        rets.append(User(username=v))
    return rets


#创建数据行
#roles = createRoles(['admin','normal','superMan','google'])
#commit(roles)
#users = createUsers(['baidu','ali','tencent'])
#commit(users)


if 'db' not in sys.argv:
    roles = selectAll(Role)
    print(roles[0].typeInt)
    print(roles[0].testStr)



if __name__=="__main__":
    #port=8888    use_reloader=False    
    #app.run() #开启debug，自动加载代码重启服务器
    manager.run()
    